package com.jyw.business.de.domain.dto.web;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jyw.business.de.constant.TaskStateConstant;
import com.jyw.business.de.constant.TaskTypeConstant;
import com.jyw.business.de.domain.DeDemandResearch;
import com.jyw.business.de.domain.DeTaskInfo;
import com.jyw.common.annotation.Excel;
import com.jyw.common.utils.DateUtils;
import com.jyw.common.utils.SecurityUtils;
import com.jyw.common.utils.bean.BeanUtils;
import com.jyw.system.domain.vo.SimpleFileVo;
import com.jyw.system.utils.FileUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("需求任务创建请求实体")
public class TaskAddDto {

    /** 需求主键 */
    @ApiModelProperty("需求主键")
    private Long demandId;

    /** 任务名称 */
    @ApiModelProperty("任务名称")
    @NotEmpty(message = "任务名称不能为空")
    private String taskName;

    /** 任务描述 */
    @ApiModelProperty("任务描述")
    private String taskRemark;

    /** 处理人 */
    @ApiModelProperty("处理人")
    @NotNull(message = "处理人不能为空")
    private Long taskUser;

    /** 期望完成日期 */
    @ApiModelProperty("期望完成日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "期望完成日期不能为空")
    private Date reqCompleteDate;

    @ApiModelProperty(value = "任务类型",hidden = true)
    private String taskType;

    @ApiModelProperty(value = "工单号",hidden = true)
    private String orderNum;

    public DeTaskInfo buildTask() {
        DeTaskInfo taskInfo = new DeTaskInfo();
        BeanUtils.copyProperties(this,taskInfo);
        taskInfo.setTaskState(TaskStateConstant.WAIT_ACCEPT);
        taskInfo.setWaitAcceptTime(DateUtils.getNowDate());
        taskInfo.setTaskHurry(0);
        taskInfo.setCreateTime(DateUtils.getNowDate());
        taskInfo.setCreateUser(SecurityUtils.getUserId());
        return taskInfo;
    }
}
